<template>
  <c-select
    v-bind="$attrs"
    v-on="$listeners"
    :value="value"
    :options="creditGoods"
    :props="props"
    @change="hangleChange"
  ></c-select>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  components: {},
  props: {
    value: String,
  },
  model: {
    prop: 'value',
    event: 'change',
  },
  data() {
    return {
      loading: false,
      props: {
        label: 'load_name',
        value: 'industrial_package_id',
      },
    }
  },
  computed: {
    ...mapGetters(['creditGoods']),
  },
  watch: {},
  created() {
    this.$store.dispatch('getCreditGoods')
  },
  mounted() {},
  methods: {
    hangleChange(val) {
      const select = this.creditGoods.find(item => item.industrial_package_id === val) || {}
      this.$emit('select', select.load_name)
    },
  },
}
</script>

<style lang="scss" scoped></style>
